package com.study.springboot.SpringBoot_A.mq.rabbitmq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 赵超
 * @Description Topic Exchange 发送者
 * @create 2018-03-29 10:30
 **/
@Component
public class TopicSender {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send0() {
        String con = "Hi, I'm msg 0 !";
        System.out.println("Sender0 " + con);
        amqpTemplate.convertAndSend("exchange", "topic.mes", con);
    }

    public void send1() {
        String con = "Hi, I'm msg 1 !";
        System.out.println("Sender1 " + con);
        amqpTemplate.convertAndSend("exchange", "topic.message", con);
    }

    public void send2() {
        String con = "Hi, I'm msg 2 !";
        System.out.println("Sender2 " + con);
        amqpTemplate.convertAndSend("exchange", "topic.messages", con);
    }
}
